package stark.app.function.pixeldraw;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.pixeldraw.lib.db.PdRecord;

import stark.app.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;

/**
 * Author：daizhongbin on 2024/7/9
 * Email：1027154338@qq.com
 * Desc:
 */
public class PixelDrawRecordAdapter extends StkProviderMultiAdapter<PdRecord> {

    public PixelDrawRecordAdapter() {
        super();
        addItemProvider(new ItemProvider());
    }

    private class ItemProvider extends BaseItemProvider<PdRecord> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_pixel_draw_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder holder, PdRecord bean) {
            ImageView ivImg = holder.getView(R.id.ivImg);
            Glide.with(ivImg).load(bean.getImgPath()).into(ivImg);
            holder.setText(R.id.tvName, bean.getName());
        }
    }

}
